package com.crois.barrier.admin.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.crois.barrier.admin.entity.LogSend;
import com.crois.barrier.admin.mapper.LogSendMapper;
import com.crois.barrier.common.exception.BarrierException;
import com.crois.barrier.common.exception.BarrierExceptionEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: HouZeYu
 * @Description:
 * @Date: Created in 17:42 2021/11/4
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class LogSendSvc extends ServiceImpl<LogSendMapper,LogSend> implements ILogSendSvc {


    @Override
    public List<LogSend> findLogSendList() {
        return baseMapper.selectList(null);
    }

    @Override
    public void addLogSend(LogSend logSend) {
        int result = baseMapper.insert(logSend);
        if (result==0){
           throw new BarrierException(BarrierExceptionEnum.BARRIER_GATEWAY_LOG_SEND_ADD_FAIL);
        }
    }
}
